#pragma once
#include <fstream>
#include <sstream>
#include <iostream>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <string>
#include <onnxruntime_cxx_api.h>

using namespace Ort;

class ResNet
{
public:
    ResNet(std::string modelPath, std::string classFilePath);
    int detect(cv::Mat &frame);
    std::vector<std::string> class_names;

private:
    int inpWidth;
    int inpHeight;
    int nout;
    int num_proposal;
    int num_class;

    std::vector<float> input_image_;
    void normalize_(cv::Mat img);
    Env env = Env(ORT_LOGGING_LEVEL_ERROR, "ResNet");
    Ort::Session *ort_session = nullptr;
    SessionOptions sessionOptions = SessionOptions();

    std::vector<char *> input_names;
    std::vector<char *> output_names;
    std::vector<std::vector<int64_t>> input_node_dims;  // >=1 outputs
    std::vector<std::vector<int64_t>> output_node_dims; // >=1 outputs

    //-------------------onnx更新后，ort_session->GetOutputName弃用，更新api后，需添加这两项vector------------
    std::vector<AllocatedStringPtr> In_AllocatedStringPtr;
    std::vector<AllocatedStringPtr> Out_AllocatedStringPtr;
};
